package com.cloudsea.yunhaistores.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.Map;

@Data
@TableName(value = "skus", autoResultMap = true) // autoResultMap = true 是为了让JSON类型处理器生效
public class Skus {
    @TableId(type = IdType.ASSIGN_ID)
    private Long id;
    private Long spuId;
    private String skuName;

    @TableField(typeHandler = JacksonTypeHandler.class)
    private Map<String, String> specs; // JSON字段

    private Long price;
    private Integer stock;
    private String skuImageUrl;
    private Integer status;
    private LocalDateTime createdAt;
    private LocalDateTime updatedAt;
}